package com.hoshiicloud.vericenter.entity.param;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hoshiicloud.common.query.PageParam;
import com.hoshiicloud.vericenter.entity.SysMessages;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * <p>
 * 查询短信功能参数
 * </p>
 *
 * @author Mr.Wu
 * @since 2019-05-20
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "查询短信功能", description = "查询短信功能")
public class SysMessagesQueryParam extends PageParam implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @ApiModelProperty(value = "主键ID")
    private Long id;

    @ApiModelProperty(value = "手机号码")
    private String mobile;

    @ApiModelProperty(value = "类别  1- 验证类  2-通知类")
    private Integer type;

    @ApiModelProperty(value = "是否有效  0-失效 1-有效")
    private Integer available;

    @JsonIgnore
    public QueryWrapper<SysMessages> convertToQueryWrapper() {
        QueryWrapper<SysMessages> queryWrapper = new QueryWrapper<SysMessages>();
        queryWrapper.eq(this.id != null, "id", this.id);
        queryWrapper.eq(StringUtils.isNotBlank(this.mobile), "mobile", this.mobile);
        queryWrapper.eq(this.type != null, "type", this.type);
        queryWrapper.eq(this.available != null, "available", this.available);
        return queryWrapper;
    }
}
